﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Script.Serialization;

namespace LyncServerExtension.Plugin.JSON
{
    /// <summary>
    /// Class to represent a json serializer.
    /// </summary>
    public sealed class JSONSerializer
    {
        private JavaScriptSerializer serializer = new JavaScriptSerializer();

        /// <summary>
        /// Serializes the specified object and returns it as a <see cref="ILyncResult"/>.
        /// </summary>
        /// <param name="obj">The object.</param>
        /// <returns>The result.</returns>
        public JSONObject Serialize(object obj)
        {
            return new JSONObject(serializer.Serialize(obj));
        }
    }
}
